﻿@{
    Layout = "~/Areas/LMS/Views/Shared/_parentLayOut.cshtml";
    ViewBag.Title = "学员登陆--WWW.JX578.COM";
}


<script type="text/javascript">
$(document).ready(function () {
        
$(".sf-menu").find("li").click(function () {
$(".sf-menu").find("li").attr("className", "");
$(this).attr("className", "current");
$(".sf-menu").find("li").each(function (i) {
$("#login_div" + i).css("display", "none");
});
$($(this).attr("chaid")).show();
})
});

//回车时，默认是登陆
function on_return(event) {
var e = event ? event : (window.event ? window.event : null);
if (e.keyCode == 13) {
if ($("#login_div0").css("display") == "block") {
UserLogin();
}
else {
CardLogon();
}
}
}

    function UserLogin() {
        var username =$.trim($("#txt_username").val());
        var password = $("#txt_password").val();
        var yzm = $("#yzm").val();
        var check = "0";
        var data = "&userName=" + username + "&pwd=" + password + "&yzm=" + yzm + "&check=" + check;
        $.ajax({
            async: false,
            type: "POST",
            url: "/Account/MemberLogin",
            dataType: "json",
            data: data,
            success: function (data) {
                switch (data) {
                    case "1": alert("用户名不能为空"); reloadcode_stu();
                        break;
                    case "2": alert("密码不能为空！"); reloadcode_stu();
                        break;
                    case "3": alert("验证码不能为空"); reloadcode_stu();
                        break;
                    case "4": alert("验证码不正确！"); reloadcode_stu();
                        break;
                    case "5":  location.href = "/Account/Infos";
                        break;
                    case "6": alert("用户名不存在！"); reloadcode_stu();
                        break;
                    case "7": alert("用户密码错误！"); reloadcode_stu();
                        break;
                    case "8": alert("用户名格式错误！"); reloadcode_stu();
                        break;
                    case "9": alert("密码格式错误"); reloadcode_stu();
                        break;
                    case "10": alert('用户被锁定或者过期！'); reloadcode_stu();
                        break;
                    case "11": alert('学习卡未激活，进入卡片激活页面！'); location.href = "/Account/CardRegister";
                        break;
                    case "12": alert('该地市暂未开放或访问出错！'); 
                        break;
                    default: alert("登录失败!"); reloadcode_stu();
                        break;
                }

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert('请求出现异常，请稍后再试'); reloadcode_stu();
            }

        });
    }


    function CardLogon() {
        var username = $.trim($("#txt_cardNo").val());
        var password = $("#txt_cardPwd").val();
        var yzm = $("#cardyam").val();
        var check = "0";
        var data = "&cardNo=" + username + "&cardPwd=" + password + "&yzm=" + yzm + "&check=" + check;
        $.ajax({
            async: false,
            type: "POST",
            url: "/Account/CardLogin",
            dataType: "json",
            data: data,
            success: function (data) {
                switch (data) {
                    case "1": alert("卡号不能为空"); reloadcode_card();
                        break;
                    case "2": alert("密码不能为空！"); reloadcode_card();
                        break;
                    case "3": alert("验证码不能为空"); reloadcode_card();
                        break;
                    case "4": alert("验证码不正确！"); reloadcode_card();
                        break;
                    case "5": location.href = "/Account/Infos";
                        break;
                    case "6": alert("登录成功！卡未绑定，进入个人信息注册页面。"); location.href = "/Account/UserRegister";
                        break;
                    case "7": alert("卡号不存在。"); reloadcode_card();
                        break;
                    case "8": alert("密码错误,请重新输入。"); reloadcode_card();
                        break;
                    case "9": alert("登录成功！卡未绑定，进入个人信息注册页面。"); location.href = "/Account/UserRegister?getType=1";
                        break;
                    case "10": alert("登录失败，账户或密码错误。"); reloadcode_card();
                        break;
                    case "12": alert('该地市暂未开放或访问出错！');
                        break;
                    default: alert("登录失败!卡号或密码不正确。"); reloadcode_card();
                        break;
                }

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert('请求出现异常，请稍后再试'); reloadcode_stu();
            }

        });
    }
</script>
<body onkeydown="on_return(event);">
<header id="top">
<div class="wrapper-login">
<div id="title"><img src="/styles/img/logo.png" alt="Administry" /></div>
<nav id="menu">
<ul class="sf-menu">
<li class="current" chaid="#login_div0"  style="display:none"><a >学员登陆</a></li>
<li  class="current" chaid="#login_div1" ><a >卡密登陆</a></li>
</ul>
</nav>
<aside><a href="#">在线客服</a> &middot; <a href="#">说明</a></aside>
</div>
</header>
<div id="login_div0" style="display:none">
<div id="pagetitle">
<div class="wrapper-login"></div>
</div>
<div id="page">
<div id="mup_lg" class="wrapper-login">
<div class="full">					
<h3>学员学习系统</h3>
<div class="box box-info">使用身份证/密码登陆系统<br /><br /></div>
<div id="mlogin">
<p>
<label class="required" for="username">用户名:</label><br/>
<input type="text" id="txt_username" class="full" value="" name="username"/>
</p>
<p>
<label class="required" for="password">密码:</label><br/>
<input type="password" id="txt_password" class="full" value="" name="password"/>
</p>
<p>
<label class="required" for="yam">验证码:</label><br/>
<input type="text" id="yzm" name="yzm" class="loginyzm"/>
<img alt="验证码" id="Img1" class="yzmimg" src="@Url.Action("CreateImageCode", "SecurityCode")" onclick="reloadcode_stu()"  />
<script type="text/javascript">
function reloadcode_stu() {
var verify = document.getElementById('Img1');
verify.setAttribute('src', '@Url.Content("~/SecurityCode/CreateImageCode?")' + Math.random());
}
$(function () {
$("#Img1").click();
});
</script>
</p>
@*<p>
<input type="checkbox" id="checkPwd" class="" value="1"  name="checkPwd"/>
<label class="choice" for="checkPwd">记住密码?</label>
</p>*@

<div class="clear">&nbsp;</div>
</div>
<input type="button" class="btn btn-green big" value="登 陆" onclick="UserLogin()" />
</div> 
</div>
</div>
</div>

@*卡密登录*@
<div id="login_div1" >
<div id="pagetitle">
<div class="wrapper-login"></div>
</div>
<div id="page">
<div id="mup_lg" class="wrapper-login">
<div class="full">					
<h3>学员学习系统</h3>
<div class="box box-info">使用学习卡卡号/密码登陆系统<br /><br /></div>
<div id="clogin">
<p>
<label class="required" for="cardNo">卡号:</label><br/>
<input type="text" id="txt_cardNo" class="full" value="" name="cardNo"/>
</p>
<p>
<label class="required" for="cardPwd">密码:</label><br/>
<input type="password" id="txt_cardPwd" class="full" value="" name="cardPwd"/>
</p>
<p>
<label class="required" for="cardyam">验证码:</label><br/>
<input type="text" id="cardyam" name="cardyam" class="loginyzm"/>
<img alt="验证码" id="cardImg" class="yzmimg" src="@Url.Action("CreateImageCodeCard", "SecurityCode")" onclick="reloadcode_card()"  />
<script type="text/javascript">
function reloadcode_card() {
var verify = document.getElementById('cardImg');
verify.setAttribute('src', '@Url.Content("~/SecurityCode/CreateImageCodeCard?")' + Math.random());
}
$(function () {
$("#cardImg").click();
});
</script>
</p>
@*<p>
<input type="checkbox" id="ckCardPwd" class="" value="1"  name="cardcheckPwd"/>
<label class="choice" for="cardcheckPwd">记住密码?</label>
</p>*@

<div class="clear">&nbsp;</div>
</div>
<input type="button" class="btn btn-green big" value="登 录" onclick="CardLogon()" />
</div> 
</div>
</div>
</div>

</body>
